package com.example.demo.jobs;

import com.example.demo.service.QutzMessageService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.PersistJobDataAfterExecution;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;

@PersistJobDataAfterExecution
@DisallowConcurrentExecution   //不允许并发执行
public class ZsgJob implements BaseJob {

    @Autowired
    private QutzMessageService qutzMessageService;

    private static Logger _log = LoggerFactory.getLogger(ZsgJob.class);

    public ZsgJob() {

    }

    public void execute(JobExecutionContext context)
            throws JobExecutionException {
        qutzMessageService.updateMessageById();
        _log.error("ZSG Job执行时间: " + new Date());

    }
}